package com.example.high_slope_electronic_sand_table.seepagePressure.controller;

import com.example.high_slope_electronic_sand_table.seepagePressure.dto.SeepagePressureMonitorDTO;
import com.example.high_slope_electronic_sand_table.seepagePressure.service.SeepagePressureMonitorService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 渗流压力监测接口
 */
@Tag(name = "渗流压力监测接口")
@RestController
@RequestMapping(value = "/high-slope")
public class SeepagePressureMonitorController {

    @Autowired
    private SeepagePressureMonitorService seepagePressureMonitorService;

    /**
     * 查询某个设备单条渗流压力监测数据
     * @return
     */
    @Operation(summary = "查询某个设备单条渗流压力监测数据")
    @GetMapping(value = "/seepage-pressure/monitor/device/{deviceId}/data")
    @Parameter(name = "deviceId", description = "监测设备ID,可以随便写一个值，返回值会附带这个值", in = ParameterIn.PATH, required = true)
    public SeepagePressureMonitorDTO getCurrentMonitorData(@PathVariable("deviceId") String deviceId){
        return seepagePressureMonitorService.getCurrentMonitorData(deviceId);
    }

    /**
     * 查询某个设备所有渗流压力监测数据
     * @return
     */
    @Operation(summary = "查询某个设备所有渗流压力监测数据")
    @GetMapping(value = "/seepage-pressure/monitor/device/{deviceId}/datas")
    @Parameter(name = "deviceId", description = "监测设备ID,可以随便写一个值，返回值会附带这个值", in = ParameterIn.PATH, required = true)
    public List<SeepagePressureMonitorDTO> listMonitorDataByDeviceId(@PathVariable String deviceId){
        return seepagePressureMonitorService.listMonitorDataByDeviceId(deviceId);
    }

    /**
     * 查询某个设备所有渗流压力监测告警数据
     * @return
     */
    @Operation(summary = "查询某个设备所有渗流压力监测告警数据")
    @GetMapping(value = "/seepage-pressure/monitor/device/{deviceId}/warning/datas")
    @Parameter(name = "deviceId", description = "监测设备ID,可以随便写一个值，返回值会附带这个值", in = ParameterIn.PATH, required = true)
    public List<SeepagePressureMonitorDTO> listWarningMonitorDataByDeviceId(@PathVariable String deviceId){
        return seepagePressureMonitorService.listWarningMonitorDataByDeviceId(deviceId);
    }

    /**
     * 查询多条渗流压力监测数据
     * @return
     */
    @Operation(summary = "查询多条渗流压力监测数据")
    @GetMapping(value = "/seepage-pressure/monitor/datas")
    public List<SeepagePressureMonitorDTO> listMonitorData(){
        return seepagePressureMonitorService.listMonitorData();
    }
}
